/*
 * @Author: your name
 * @Date: 2021-07-07 15:01:29
 * @LastEditTime: 2022-02-18 13:41:36
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \exc-tl1-2\SRC\user_src\device_ctrl.h
 */
/**
	*文件名称：
	*
	*文件日期：
	*
	*文件描述：
	*
	*文件版本：V1.0
	*
	*/

#ifndef DEVICE_CTRL_H
#define DEVICE_CTRL_H

/* 头文件包含区	*/
#include "module_control.h"
#include "main.h"

/* 类型声明区 */
typedef enum
{
	RED,
	BLUE
} LED_TYPE;

/* 宏定义区 */

#ifndef OLD_BOARD
#define RED_SET (GPIO->PCCLR |= 1 << 7)
#define RED_RESET (GPIO->PCSET |= 1 << 7)
#define BLUE_SET (GPIO->PCCLR |= 1 << 6)
#define BLUE_RESET (GPIO->PCSET |= 1 << 6)

#define LAMP1_SET (GPIO->PBCLR |= 1 << 10)
#define LAMP1_RESET (GPIO->PBSET |= 1 << 10)

#define LAMP2_SET (GPIO->PACLR |= 1 << 9) 
#define LAMP2_RESET (GPIO->PASET |= 1 << 9)
#else
#define RED_SET (GPIO->PCCLR |= 1 << 8)
#define RED_RESET (GPIO->PCSET |= 1 << 8)
#define BLUE_SET (GPIO->PCCLR |= 1 << 7)
#define BLUE_RESET (GPIO->PCSET |= 1 << 7)

#define LAMP1_SET (GPIO->PCSET |= 1 << 0)
#define LAMP1_RESET (GPIO->PCCLR |= 1 << 0)
#define LAMP2_SET (GPIO->PCSET |= 1 << 0)
#define LAMP2_RESET (GPIO->PCSET |= 1 << 0)
#endif

#define U32_PLUS(x)          \
	(x) = swapUint32_t((x)); \
	(x)++;                   \
	(x) = swapUint32_t((x));

/* 函数声明区 */
void led(uint16_t delay_time, LED_TYPE led_type, uint16_t cycle, uint16_t compare, uint16_t cnt);
void led_state_check(void);
void lamp_state_ctrl(void);
void LAMP(uint16_t delay_time, uint16_t cycle, uint16_t compare, uint16_t cnt);
void device_run_time(void);
void device_run_time(void);
void flash_test(void);
void light_sw_init(void);

#endif
